﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiscreteMath.Tests
{
    public class WordGenerator
    {
        private Random rng = new Random();
        private IList<char> alphabet;

        public WordGenerator(IList<char> alphabet)
        {
            this.alphabet = alphabet;
        }

        public string GenerateWord(int length)
        {
            if (length == 0)
                return SpecialSigns.EmptyWord.ToString();

            var builder = new StringBuilder();
            for (int i = 0; i < length; i++)
            {
                builder.Append(this.alphabet[rng.Next(this.alphabet.Count)]);
            }
            var word = builder.ToString();
            return word;
        }

        public string GenerateConcatenated(string text, int length)
        {
            var builder = new StringBuilder();
            for (int i = 0; i < length; i++)
            {
                builder.Append(text);
            }
            return builder.ToString();
        }
    }
}
